Moved begin() since the lock() function may cause a BEGIN.
authorAaron <aschulz@wikimedia.org>
Fri, 21 Sep 2012 23:00:02 +0000 (16:00 -0700)
committerAaron <aschulz@wikimedia.org>
Fri, 21 Sep 2012 23:00:02 +0000 (16:00 -0700)
Change-Id: Ib5f7d6b7464a27d08de12c63495374319ac09dfe

includes/SiteStats.php

index 1c2c454..422d606 100644 (file)
@@ -286,6 +286,8 @@ class SiteStatsUpdate implements DeferrableUpdate {
                        $this->doUpdatePendingDeltas();
                } else {
                        $dbw = wfGetDB( DB_MASTER );
+                       // Need a separate transaction because this a global lock
+                       $dbw->begin( __METHOD__ );
 
                        $lockKey = wfMemcKey( 'site_stats' ); // prepend wiki ID
                        if ( $rate ) {
@@ -306,9 +308,6 @@ class SiteStatsUpdate implements DeferrableUpdate {
                                $this->images   += ( $pd['ss_images']['+'] - $pd['ss_images']['-'] );
                        }
 
-                       // Need a separate transaction because this a global lock
-                       $dbw->begin( __METHOD__ );
-
                        // Build up an SQL query of deltas and apply them...
                        $updates = '';
                        $this->appendUpdate( $updates, 'ss_total_views', $this->views );